From 05dc18029acd424949fb43645d228ca43ccc6a98 Mon Sep 17 00:00:00 2001 From: "Carol (Nichols || Goulding)" Date: Sat, 19 Sep 2015 10:41:06 -0400 Subject: [PATCH] Move test to a more appropriate location This test isn't testing generate-lockfile at all-- it's generating a lockfile with `\r\n` in it in the test itself and then testing that building will succeed even if there are `\r\n`s in the lockfile. Given that generate-lockfile could change and have no effect on this test, I think this fits in better with the other `cargo build` tests. --- tests/test_cargo_compile.rs | 25 +++++++++++++++++++++++++ tests/test_cargo_generate_lockfile.rs | 25 ------------------------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/tests/test_cargo_compile.rs b/tests/test_cargo_compile.rs index 6b54f05c9..e16456977 100644 --- a/tests/test_cargo_compile.rs +++ b/tests/test_cargo_compile.rs @@ -650,6 +650,31 @@ consider running `cargo update` to update a path dependency's locked version ")); }); +test!(ignores_carriage_return_in_lockfile { + let p = project("foo") + .file("Cargo.toml", r#" + [package] + name = "foo" + authors = [] + version = "0.0.1" + "#) + .file("src/main.rs", r#" + mod a; fn main() {} + "#) + .file("src/a.rs", ""); + + assert_that(p.cargo_process("build"), + execs().with_status(0)); + + let lockfile = p.root().join("Cargo.lock"); + let mut lock = String::new(); + File::open(&lockfile).unwrap().read_to_string(&mut lock).unwrap(); + let lock = lock.replace("\n", "\r\n"); + File::create(&lockfile).unwrap().write_all(lock.as_bytes()).unwrap(); + assert_that(p.cargo("build"), + execs().with_status(0)); +}); + test!(crate_version_env_vars { let p = project("foo") .file("Cargo.toml", r#" diff --git a/tests/test_cargo_generate_lockfile.rs b/tests/test_cargo_generate_lockfile.rs index ddfa48ea7..276791aa0 100644 --- a/tests/test_cargo_generate_lockfile.rs +++ b/tests/test_cargo_generate_lockfile.rs @@ -6,31 +6,6 @@ use hamcrest::assert_that; fn setup() {} -test!(ignores_carriage_return { - let p = project("foo") - .file("Cargo.toml", r#" - [package] - name = "foo" - authors = [] - version = "0.0.1" - "#) - .file("src/main.rs", r#" - mod a; fn main() {} - "#) - .file("src/a.rs", ""); - - assert_that(p.cargo_process("build"), - execs().with_status(0)); - - let lockfile = p.root().join("Cargo.lock"); - let mut lock = String::new(); - File::open(&lockfile).unwrap().read_to_string(&mut lock).unwrap(); - let lock = lock.replace("\n", "\r\n"); - File::create(&lockfile).unwrap().write_all(lock.as_bytes()).unwrap(); - assert_that(p.cargo("build"), - execs().with_status(0)); -}); - test!(adding_and_removing_packages { let p = project("foo") .file("Cargo.toml", r#" -- 2.30.2